#define _CRT_SECURE_NO_WARNINGS 1

// https://www.acwing.com/problem/content/6299/

#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int n;
string g[2];

int main()
{
    cin >> g[0] >> g[1];
    n = g[0].size();

    int l = 0, r = n - 1;
    while (l < n && g[0][l] != '#' && g[1][l] != '#')
        l++;

    if (l == n)
    {
        cout << 0 << endl;
        return 0;
    }

    while (r >= 0 && g[0][r] != '#' && g[1][r] != '#')
        r--;

    int res = 0;
    while (l < r)
    {
        char c1 = g[0][l], & c2 = g[0][l + 1];
        char c3 = g[1][l], & c4 = g[1][l + 1];

        if (c1 == '#' && c3 == '#')
        {
            if (c2 == '.' && c4 == '.')
                c2 = c4 = '#', res++;
            l++;
            continue;
        }
        else if (c1 == '#' && c2 == '.')
            c2 = '#', res++;
        else if (c3 == '#' && c4 == '.')
            c4 = '#', res++;

        l++;
    }

    cout << res << endl;

    return 0;
}

